﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace MyMedia
{
    public class Log
    {
        public void Write(string Msg)
        {
            StreamWriter writer = File.AppendText(Application.StartupPath + "//Log.txt");
            writer.WriteLine(Msg);
            writer.Close();
        }
        public void Write(string Msg, string Path)
        {
            StreamWriter writer = File.AppendText(Path);
            writer.WriteLine(Msg);
            writer.Close();
        }
        public void Write(string Msg, bool AutoDateTime)
        {
            StreamWriter writer = File.AppendText(Application.StartupPath + "//Log.txt");
            if (AutoDateTime)
                writer.WriteLine(DateTime.Now.ToString("M/d/yyyy") + " " + string.Format("{0:HH:mm:ss tt}: ", DateTime.Now) + Msg);
            else
                writer.WriteLine(Msg);
            writer.Close();
        }
        public void Write(string Msg, string Path, bool AutoDateTime)
        {
            StreamWriter writer = File.AppendText(Path);
            if (AutoDateTime)
                writer.WriteLine(DateTime.Now.ToString("M/d/yyyy") + " " + string.Format("{0:HH:mm:ss tt}: ", DateTime.Now) + Msg);
            else
                writer.WriteLine(Msg);
            writer.Close();
        }
    }
}
